home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 October
/
Ahoy_Magazine_86-10_1986_Double_L.d64
/
Word Wrapper
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-10-26
|
711b
|
23 lines
0 poke53280,0:poke53281,6:poke646,1
1 print"[147]commodares problem #30-3"
2 print" word wrapper":print
3 rem solution by
4 rem jim speers
5 rem
10 l$="[157]":b$=" ":fori=1to79:ll$=ll$+l$:bl$=bl$+b$:next:d$=chr$(20)
20 q$=chr$(34)+chr$(20)+chr$(34):wl=0:ll=0:c$="[175]":print""c$;
30 getz$:ifz$="" then 30
40 if z$="_" then print l$;b$:end
50 x=asc(z$):if x=32 then wl=0:w$="":ll=ll+1:print l$z$c$;:goto 140
60 if x=34 then print l$q$c$;:wl=wl+1:ll=ll+1:wl$=wl$+q$:goto 140
70 if x=13 then print l$b$:print c$;:ll=0:wl=0:w$="":goto 30
80 if x<>20 then 120
90 print d$d$c$;:ll=ll-1:if wl>0 then wl=wl-1:w$=left$(w$,len(w$)-1)
100 if ll<0 then ll=ll+80
110 goto 30
120 if (x>16andx<32) or (x>127andx<160) then 30
130 print l$z$c$;:w$=w$+z$:wl=wl+1:ll=ll+1
140 if ll<81 then 30
150 if wl=0 then 30
160 print left$(ll$,wl+1)left$(bl$,wl-1)w$c$;:ll=wl:goto 30